import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { viteMockServe } from 'vite-plugin-mock'

// https://vitejs.dev/config/
export default ({ command }) => {
  console.log(command)
  return defineConfig({
    plugins: [
      react(),
      viteMockServe({
        mockPath: 'mock',
        localEnabled: command === 'serve'
      })
    ],
    // 反向代理
    server: {
      port: 1992,
      // proxy: {
      //   '/api': {
      //     target: 'http://10.95.23.209:1992',
      //     changeOrigin: true,
      //     rewrite: (path) => path.replace(/^\/api/, '')
      //   },
      // }
    }
  })
}
